<%--
    author: Ivan Holub
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Administration</title>
    <script type="text/javascript">
        function makeCode() {
            var text1 = document.getElementById("name").value;
            var input2 = document.getElementById("code");
            input2.value = text1.toLowerCase().replace(/ /g, "-");
        }
    </script>
</head>
<body>

<jsp:include page="header.jsp"/>

<h3>Create/Edit Artist</h3>

<spring:bind path="command.*">
    <c:if test="${status.error}">
        <p>
            <c:forEach items="${status.errorMessages}" var="error">
                <span style="color:red;"><c:out value="${error}"/></span><br>
            </c:forEach>
        </p>
    </c:if>
</spring:bind>

<form:form>
    <table>
        <tr>
            <td>Name:</td>
            <td><form:input path="name" id="name" onchange="makeCode();"/></td>
        </tr>
        <tr>
            <td>Code:</td>
            <td><form:input path="code" id="code"/></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="Save"/></td>
        </tr>
    </table>
</form:form>

<jsp:include page="footer.jsp"/>

</body>
</html>